package com.web.rss.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class Test extends JFrame implements ActionListener, ItemListener{

	/**
	 * 
	 */
	private static final long serialVersionUID = -8978139201506793071L;

	public Test () {
		this.setSize(640,480);
		this.setMinimumSize(new Dimension(50,50));
		MainMenuBar menu = new MainMenuBar("fr");
		setLayout(new BorderLayout());
		
		Dimension minDim = new Dimension(10,10);
		
		JTextArea feedListArea = new JTextArea();
		feedListArea.setEditable(false);
		JScrollPane feedListPane = new JScrollPane();
		feedListPane.setPreferredSize(new Dimension(240,420));
		feedListPane.setMinimumSize(minDim);
		
		JTextArea feedContentArea = new JTextArea();
		feedContentArea.setEditable(false);
		JScrollPane feedContentPane = new JScrollPane();
		feedContentPane.setPreferredSize(new Dimension(410,150));
		feedContentPane.setMinimumSize(minDim);
		
		JTextArea feedArticleArea = new JTextArea();
		feedArticleArea.setEditable(false);
		JScrollPane feedArticlePane = new JScrollPane();
		feedArticlePane.setPreferredSize(new Dimension(410,260));
		feedArticlePane.setMinimumSize(minDim);
		
		
		JSplitPane verSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
											feedContentPane,
											feedArticlePane);
		verSplit.setOneTouchExpandable(true);
		verSplit.setResizeWeight(0.4);
		
		JSplitPane horSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
											feedListPane,
											verSplit);
		horSplit.setOneTouchExpandable(true);
		horSplit.setResizeWeight(0.3);
		
		this.setJMenuBar(menu);
		this.add(horSplit);
		//this.add(verSplit);
		
		this.addWindowListener(new windowListener());
	}
	
	public void actionPerformed (ActionEvent ev) {
		
	}
	
	public void itemStateChanged(ItemEvent ev) {
		
	}
	
	class windowListener extends WindowAdapter {
		public void windowClosing (WindowEvent wEv) {
			Test.this.setVisible(false);
			Test.this.dispose();
			System.exit(0);
		}
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
		    // Set System L&F
	        UIManager.setLookAndFeel(
	            UIManager.getSystemLookAndFeelClassName());
	    } 
	    catch (UnsupportedLookAndFeelException e) {
	       // handle exception
	    }
	    catch (ClassNotFoundException e) {
	       // handle exception
	    }
	    catch (InstantiationException e) {
	       // handle exception
	    }
	    catch (IllegalAccessException e) {
	       // handle exception
	    }

		
		Test test = new Test();
		test.setVisible(true);
	}

}
